home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
graphic
/
piclb191.zip
/
PICLAB.DOC
< prev
next >
Wrap
Text File
|
1991-12-03
|
40KB
|
1,076 lines
PICLAB.DOC
December 3, 1991
Piclab 1.91 is a public domain image processing program by Lee
Daniel Crocker and the Stone Soup Group. It should be distributed
with the following files:
PL.EXE The program itself.
PL286.EXE Faster, smaller version for 286 (and up) machines.
PICLAB.DOC This file.
PL.HLP Text file for the HELP command.
PICLAB.PIF Windows 3.0 386 enhanced mode PIF.
PICLAB.ICO Windows 3.0 icon.
GAMMA1.MAP \
GAMMA2.MAP X Color maps for viewing grayscale and pseudo-color.
PSEUDO.MAP /
SSTOOLS.SMP Sample SSTOOLS.INI file.
If you are missing one or more of these files, contact the author
at one of the addresses listed at the end of this document.
Overview
========
Piclab operates on "images", so I will begin by explaining exactly
what an image is and how Piclab classifies them.
For our purposes, an image is a data set that describes
the reflectance of a 2-dimensional surface such as a photograph. In
particular, an image is a 2-dimensional array of "pixels" (a short
form of "picture elements"), each of which contains data for the
small rectangular area of the image it represents.
There are many systems in which image data represents "objects"
rather than pixels. PostScript is probably the most notable example.
The commands sent to a PostScript device tell it to draw lines or
boxes or characters and let the device decide how it will perform the
commands it gets. Piclab does not deal with object-based images or
devices.
Image data comes in several flavors, and while all are related in
many ways, there are distinctions important to keep in mind. I will
divide image data into four classes: bitmapped, grayscale,
golor-mapped, and true-color. In all of these formats an image is
represented as a rectangular array of pixels, each of which may
contain some value.
Bitmapped images are collections of on/off dots. That is, each pixel
can be either "on" or "off", with no states in between. This type of
image can be displayed on just about any type of computer and is
especially suited to printer output. The disadvantages are the
inability to represent color, and the lack of detail. With large
bitmapped images, one can get a surprising amount of detail by
simulating shades of gray by dot patterns. This process, called
halftoning, is used by newspapers to print photographs.
At this time, Piclab does not deal directly with bitmapped images,
although it can treat them as grayscale and can output images to
bitmapped devices.
Grayscale images represent images by storing the intensity of light
for each pixel on a scale of more than just on/off. Typically, a
grayscale image will allow 64 to 256 shades of gray at each pixel.
Very high quality renderings of black and white photographs can be
stored in this format.
As an aside, the term "black and white" is often used to describe
both bitmapped images and grayscale images. For this reason, I will
not use the term in this document. Another common term for grayscale
is "monochrome", which is often used to describe monitors that can
display only shades of one color (often green or amber).
Color-mapped images are the ones most common on personal computers.
Each pixel in an image is represented by a number (called an index)
that is used to look up the pixel's actual color in a table (called
the palette, much like an artist's palette). These images are
popular because they can be very colorful, yet take up less memory
than full-color images (described next). The size of the color
palette varies among formats, but is typically 16 to 256.
True-color images are the highest quality representation, and the
largest files as well. Each pixel contains the complete color
information for that pixel, usually expressed as the intensity of the
red, green, and blue color components of the light at that location.
Piclab deals directly with grayscale, color-mapped and true-color
images, regardless of the display capabilities of the hardware on
which it is running. In fact, Piclab can be used to enhance and
print images on machines with no display at all.
I must stress that there is no connection between the images
Piclab deals with and the type of display on your computer. Piclab
has a SHOW command that displays the image it is working with, but if
the image is more detailed than your display can handle, Piclab will
do its best to approximate the image on your display. Regardless of
what the display looks like, the image itself is always stored and
operated upon in full detail.
So what's the point? You might think that having image data more
accurate than your computer can display is wasteful, but it is not.
One reason is that images get passed around to users of different
machines, and the more accurate the image data, the better each
machine will be able to display it. You can also do things like
print color images to a color printer even though you have no color
display on your computer. Lastly, hardware to display images as
accurately as Piclab stores them does exist, and is becoming more
affordable every day. If you keep your images stored in their full
accuracy, you will be better able to take advantage of any new
hardware you may get.
General Operation
=================
After starting Piclab by typing "PL" at the system command line, the
user may enter any of a number of commands, each of which is
performed immediately.
If you give arguments to the PL command, the first is taken as the
name of a file containing Piclab commands, and the rest are treated
as arguments to that program, accessed as %1, %2, etc., much like DOS
batch file arguments. This feature can be used to create programs
for specific tasks.
Commands generally operate on two internal picture buffers called OLD
and NEW. Most commands start by deleting OLD and renaming NEW to
OLD. They then perform some transformation on OLD storing the result
in NEW. The command UNDO swaps NEW and OLD--effectively reversing
the last operation.
OLD and NEW are stored on disk. This decision was made primarily
because my taste in pictures is better than my budget for RAM. If
you are dealing with simpler pictures, or if you have RAM to burn,
you can direct Piclab to store OLD and NEW on a RAMdisk. In MSDOS
and similar operating systems, this is done by typing "SET TMP=D:" at
the system command line before running Piclab, where D: is the drive
or directory specification of the RAMdisk.
Piclab can read and write images in different file formats. The LOAD
command is used to read an image in one of these formats into the
edit buffers. The SAVE is used to write the contents of the edit
buffers into one of these formats. Every session with Piclab will
generally begin with a LOAD, and end with a SAVE (or perhaps a PRINT)
with some processing in between. A file may be loaded from one file
format and saved in a different one, thereby converting among formats.
Command parsing in Piclab is roughly like that of the system command
line. The line is broken into words that must be separated by
spaces; the first word specifies the actual command and the remaining
words are passed to the command handler as arguments. The individual
command-handling routines are responsible for interpreting their
arguments. Generally, a word may be shortened as long as it does not
conflict with any other word in the same context. For example, the
LIST COMMANDS command may be abbreviated LIS COM.
Any words in the command line that begin with the '%' character are
replaced as follows: if the remainder of the word is a number, the
word is replaced with the argument to the PL command in that position
(starting with 0). Otherwise, the word is replaced with the value of
the DOS environment variable named by the word. For example, here is
a short Piclab program (named V2E) to convert a VGA 256-color image
into an EGA 16-color image:
GLOAD %1
UNMAP
RESCALE 640 350
EGAPAL
MAP
GSAVE %2
With this program in the current directory, typin